﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class BANNER
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _B_ID =-99;
        private string _B_NAME="";
        private string _B_URL="";
        private bool _ISDELETED = false;
        private bool _ISACTIVE = true;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public bool ISACTIVE
        {
            get
            {
                return _ISACTIVE;
            }
            set
            {
                _ISACTIVE = value;
            }
        }

        public long B_ID
        {
            get
            {
                return _B_ID;
            }
            set
            {
                _B_ID = value;
            }
        }
       

        public string B_NAME
        {
            get
            {
                return _B_NAME;
            }
            set
            {
                _B_NAME = value;
            }
        }

        public string B_URL
        {
            get
            {
                return _B_URL;
            }
            set
            {
                _B_URL = value;
            }
        }
        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@B_ID", B_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@B_NAME", B_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@B_URL", B_URL, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED", ISDELETED,DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4};
                return DAC.Save("BANNER_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long B_ID, string B_NAME, string B_URL, bool ISDELETED, bool ISACTIVE, string andor) 
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@B_ID", B_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@B_NAME", B_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@B_URL",B_URL, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED",ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                DataTable dt = DAC.Select("BANNER_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}
